<template>
  <div class="base-container">
    <el-table
      v-loading="tableLoading"
      :data="processData"
      style="width: 100%"
      @selection-change="selectionChangeHandle"
    >
      <template v-for="(item, index) in cptColumn">
        <el-table-column :key="index" :prop="item.prop" :label="item.label" />
      </template>
    </el-table>
    <el-pagination
      :current-page="query.page"
      :page-sizes="[5, 10, 20, 400]"
      :page-size="query.size"
      layout="total, sizes, prev, pager, next, jumper"
      :total="query.totalRow"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script>
/*
  通用表格使用说明
    配套功能 ---  
      1.工具栏 --- 配置列、增、删、改、查
      2.表格自动渲染列
      3.分页栏
    使用步骤
      1.引入 CURD类
      2.引入需要的组件
*/
import toolBar from "@/components/common/toolBar";
import curd from "@/mixins/curd";
const CURD = new curd({
  url: "/sys/monitor/actionLog/"
});
export default {
  components: { toolBar },
  mixins: [CURD],
  props: {
    username: {
      type: String
    }
  },
  data() {
    return {
      tableColumnConfig: [
        { id: 1, label: "接口", prop: "actionKey", show: true },
        { id: 2, label: "IP", prop: "ip", show: true },
        { id: 2, label: "创建时间", prop: "created", show: true }
      ],
      toolQuery: {
        username: this.username
      }
    };
  }
};
</script>

<style lang="scss">
@import "@/styles/base/index.scss";
.el-pagination {
  position: static;
}
</style>
